﻿using Permission.Service;
using Permission.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace Permission.Controllers
{
    public class HomeController : Controller
    {
        private readonly IUserService _userService;

        public HomeController(IUserService userService)
        {
            _userService = userService;
        }

        public ActionResult Login()
        {
            return View();
        }

        [HttpPost]
        public JsonResult Login(UserModel model)
        {
            ExecuteResult<UserModel> result = _userService.Sign(model);
            Session["User"] = result.Data;
            return Json(result);
        }
    }
}
